import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
//        List<Integer> list = new ArrayList<>();
        int[] a = new int[n];
        int[] book = new int[n];
        char[] ans = new char[n];
        for(int i = 0; i < n; i++){
            a[i] = scanner.nextInt();
        }
        char man = 'A';
        while (!judge(book)){
            int pos = 0, max = -1;
            for(int i = 0; i < n; i++){
                if(book[i] == 0 && a[i] > max){
                    max = a[i];
                    pos = i;
                }
            }
            book[pos] = 1;
            ans[pos] = man;
            int cnt = 0;
            for(int i = pos - 1; i >= 0 && cnt < m; i--){
                if(book[i] == 1){
                    continue;
                }
                book[i] = 1;
                ans[i] = man;
                cnt++;
            }
            cnt = 0;
            for(int i = pos + 1; i < n && cnt < m; i++){
                if(book[i] == 1){
                    continue;
                }
                book[i] = 1;
                ans[i] = man;
                cnt++;
            }
            man = man == 'A' ? 'B' : 'A';
        }
        for (char an : ans) {
            System.out.print(an);
        }
    }
    private static boolean judge(int[] book){
        for (int i : book) {
            if(i == 0){
                return false;
            }
        }
        return true;
    }
}
